package cn.rbac.dao.imp;

import org.hibernate.Session;

import cn.rbac.dao.IUserDao;
import cn.rbac.model.User;
import cn.rbac.util.HibernateUtil;

public class UserDaoImp extends BaseDaoImp<User> implements IUserDao{


	public User getUserByName(String name){
		Session session=HibernateUtil.getSessionFactory().openSession();
		session.beginTransaction();
		 String hql="from User as user where user.name=:name";
		 User user=(User)session.createQuery(hql).setString("name", name).uniqueResult();
		session.getTransaction().commit();
		session.close();
		return user;
	}
	
}
